package com.santu.edu.supporter.biz.user.pojo.dto;

import com.santu.edu.supporter.biz.user.pojo.params.UserAddressAddParam;
import com.santu.edu.supporter.biz.user.pojo.params.UserAddressUpdateParam;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * @author 12158
 */
@Data
@Accessors(chain = true)
public class UserAddressDTO {

    /**
     * 地址id
     */
    private String addressId;

    /**
     * 用户id
     */
    private String userId;

    /**
     * 收件人姓名
     */
    private String userName;

    /**
     * 收件人电话
     */
    private String phone;

    /**
     * 省级区划编号
     */
    private String provinceCode;


    /**
     * 省级名称
     */
    private String provinceName;


    /**
     * 市级区划编号
     */
    private String cityCode;

    /**
     * 市级名称
     */
    private String cityName;

    /**
     * 区级区划编号
     */
    private String districtCode;

    /**
     * 区级名称
     */
    private String districtName;


    /**
     * 详细地址
     */
    private String detail;

    /**
     * 是否默认
     */
    private String isDefault;

    public static UserAddressDTO createItem(String userId,String addressId,UserAddressAddParam addParam) {
        return new UserAddressDTO()
                .setAddressId(addressId)
                .setUserId(userId)
                .setUserName(addParam.getUserName())
                .setPhone(addParam.getPhone())
                .setProvinceCode(addParam.getProvinceCode())
                .setProvinceName(addParam.getProvinceName())
                .setCityCode(addParam.getCityCode())
                .setCityName(addParam.getCityName())
                .setDistrictCode(addParam.getDistrictCode())
                .setDistrictName(addParam.getDistrictName())
                .setDetail(addParam.getDetail())
                .setIsDefault(addParam.getIsDefault());
    }


    public static UserAddressDTO createItem(String userId,UserAddressUpdateParam updateParam) {
        return new UserAddressDTO()
                .setAddressId(updateParam.getAddressId())
                .setUserId(userId)
                .setUserName(updateParam.getUserName())
                .setPhone(updateParam.getPhone())
                .setProvinceCode(updateParam.getProvinceCode())
                .setProvinceName(updateParam.getProvinceName())
                .setCityCode(updateParam.getCityCode())
                .setCityName(updateParam.getCityName())
                .setDistrictCode(updateParam.getDistrictCode())
                .setDistrictName(updateParam.getDistrictName())
                .setDetail(updateParam.getDetail())
                .setIsDefault(updateParam.getIsDefault());
    }



}
